package cc.fine.svc.main.controller;

import cc.fine.svc.common.utils.R;
import cc.fine.svc.main.service.qiniu.QiniuKodoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @AUTHOR: wyihe
 * @DATE: 2023/10/26
 */
@RestController
@RequestMapping("/qiniu/kodo")
@Api(description = "七牛云文件存储服务")
public class QiniuKodoController {

    @Autowired
    private QiniuKodoService qiniuKodoService;

    @PostMapping("/upload")
    @ApiOperation("上传文件并返回加载url")
    public R upload(MultipartFile file) {
        String url = qiniuKodoService.upload(file);
        return R.ok().data("url", url);
    }

}
